const userEl = document.querySelector("input[type='text']");
const pwdEl = document.querySelector("input[type='password']");
const submitBtn = document.querySelector("input[type='submit']");
const form = document.querySelector('form');
const userinfo = JSON.parse(localStorage.getItem('userinfo'));
form.addEventListener("submit",function(e){
    e.preventDefault();
    const userName = userEl.value;
    const passWord = pwdEl.value;
    
    
    userinfo.forEach(item => {
        if(item.userName === userName && item.passWord === passWord){
            location.href="http://localhost:8888/index.html";
        }
        else{
            alert('用户名或密码输入有误');
        }
    });

})
